/*
 * Created with IDEA.
 * Description: A fully open-sourced high performance unibody close-loop driver for
 * Step-Motor, which was used in my DummyRobot project:
 * https://github.com/peng-zhihui/Dummy-Robot
 * Based on XDrive project: https://github.com/unlir/XDrive
 * @Author: Pengzhihui
 * @Date: ${DATE} ${TIME}
 *
 */

//
// Created by deng on 2022/12/25.
//
#include "mt6816_stm32.h"
#include "bsp_led.h"
#include "bsp_spi.h"
void MT6816::SpiInit()
{
    MX_SPI3_Init();
}


uint16_t MT6816::SpiTransmitAndRead16Bits(uint16_t _dataTx)
{
    uint16_t dataRx;

   // GPIOA->BRR = GPIO_PIN_15; // Chip select
    MT6816_CS_L;
    HAL_SPI_TransmitReceive(&hspi3, (uint8_t*) &_dataTx, (uint8_t*) &dataRx, 1, HAL_MAX_DELAY);
    MT6816_CS_H;
   // GPIOA->BSRR = GPIO_PIN_15;

    return dataRx;
}
